package com.qhx.backme.controller;

import com.qhx.backme.model.Result;
import com.qhx.backme.model.vo.UserEntityVO;
import com.qhx.backme.service.QueryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api( tags = "查询功能接口")
@RestController
@RequestMapping("/finance/query")
public class QueryController {
    @Autowired
    QueryService queryService;

    @ApiOperation(value = "列出所有公司信息", notes = "列出所有公司信息")
    @GetMapping("/listCompany")
    public Result listCompany(@RequestParam("address") String address){
        return queryService.listCompany(address);
    }

    @ApiOperation(value = "列出所有银行信息", notes = "列出所有银行信息")
    @GetMapping("/listBank")
    public Result listBank(@RequestParam("address") String address) {
        return queryService.listBank(address);
    }

    @ApiOperation(value = "列出所有凭证信息", notes = "列出所有凭证信息")
    @GetMapping("/listAllReceipt")
    public Result listAllReceipt(@RequestParam("address") String address) {
        return queryService.listAllReceipt(address);
    }

    @ApiOperation(value = "获取公司实体详细信息(详情，凭证列表)", notes = "获取公司实体详细信息(详情，凭证列表)")
    @GetMapping("/getCompanyEntity")
    public Result<UserEntityVO> getCompanyEntity(@RequestParam("address") String address,
                                                 @RequestParam("queryAddress") String queryAddress) {
        return queryService.getCompanyEntity(address, queryAddress);
    }

    @ApiOperation(value = "获取银行实体详细信息(详情，凭证列表)", notes = "获取银行实体详细信息(详情，凭证列表)")
    @GetMapping("/getBankEntity")
    public Result<UserEntityVO> getBankEntity(@RequestParam("address") String address,
                                              @RequestParam("queryAddress") String queryAddress) {
        return queryService.getBankEntity(address, queryAddress);
    }
}
